
library(flexclust) # Loads flexclust library.
library(RSuperMap)
library(sp)

ds <- OpenDatasource("E:/d.udb", alias = "test", engine = "udb")

dataset <- GetDataset(ds, "BuildingPoint")

data.df <- Query2DF(dataset)

coord <- coordinates(data.df)

cl1 = qtclust(coord, radius = 700)

plot(coord, col=predict(cl1), xlab="", ylab="")

d = data.frame(cl=attributes(cl1)$cluster) 

data.df$cluster_1 = d$cl

res <- WriteSpData(data.df, ds, GetAvailableDatasetName(ds, "cluster_result"))

CloseDatasource(ds)
